#include<stdio.h>

int main(void)
{
	double a,b,c,p,q;
	scanf("%lf %lf %lf %lf %lf",&a,&b,&c,&p,&q);
	printf("%.3lf",(a/2*q*q+b/3*q*q*q+c/4*q*q*q*q)-(a/2*p*p+b/3*p*p*p+c/4*p*p*p*p));
	
	return 0;
}
